<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ListPlan</title>
<link rel="stylesheet" type="text/css" href="../css/blueprint/screen.css" media="screen, projection"/>
<link rel="stylesheet" type="text/css" href="../css/blueprint/plugins/buttons/screen.css" media="screen, projection"/>
<script type="text/javascript" src="../script/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.tablecross-0.1.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.pageit-0.1.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.ajaxtip-0.1.js"></script>
<script type="text/javascript">
    var queryVO = ""; 
    $(document).ready(function() {
    	$("#DOC_FORM").ajaxProccessTip();
    	getData(queryVO, 1, 10);
    	$("#pageBar").pageListener(getData, queryVO);
    	$("#DELETE_BUTTON").click(function() {
        	if ($(".select_box:checked").length == 0) {
            	alert('请选择要删除的管理办法');
        	} else {
        		$("#DOC_FORM").attr("action", "DeleteDoc.action");
        		$("#DOC_FORM").submit();
        	}
    	});
    	$("#EDIT_BUTTON").click(function() {
        	if ($(".select_box:checked").length == 0) {
            	alert('请选择1个要编辑的管理办法');
        	} else if ($(".select_box:checked").length != 1) {
        		alert('只能选择1个要编辑的管理办法');
        	} else {
        		$("#DOC_FORM").attr("action", "EditDoc.action");
        		$("#DOC_FORM").submit();
        	}
    	});
    });

    function getData(queryVO, pageIndex, pageSize) {
    	$.ajax({
            type: "post",
            url: "DisplayDocList.action",
            data: {"queryVO": queryVO, "pageVO.pageIndex": pageIndex, "pageVO.pageSize": pageSize},
            dataType: "json",
            success: function(data) {
                if (data == null) {
                    alert('非法的请求，请确认你是否有权限执行该操作！');
                    return;
                }
                var strArr = new Array();
                for (var i = 0; i < data.docList.length; i++) {
                    strArr.push('<tr>');
                    strArr.push('<td><input type="checkbox" name="docId" class="select_box" value="' + data.docList[i].did + '" /></td>');//号
                    strArr.push('<td><a href="DocDetail.html?docId=' + data.docList[i].did + '" target="_blank">' + data.docList[i].title + '</a></td>');//标题
                    strArr.push('<td>' + data.docList[i].title + '</td>');//标题
                    strArr.push('<td>' + data.docList[i].createDate + '</td>');//创建时间
                    strArr.push('<td>' + data.docList[i].updateDate + '</td>');//更新时间 
                    strArr.push('</tr>');
                }
                $("#DOC_TBODY").html(strArr.join(''));
                $("#DOC_TBODY").tablecross('', 'odd', 'over');
                $("#pageBar").pageRender(data.pageVO.pageIndex, data.pageVO.pageSize, data.pageVO.pageNum);
            }
    	});
    }
</script>
<style type="text/css">
tr.odd td {
    background: #ecf6fc;
}

tr.over td {
    background: #bcd4ec;
}
</style>
</head>
<body>
<table style="margin-bottom: 0px" width="98%" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td width="80%" style="padding: 0px" align="left"><button type="button" id="EDIT_BUTTON"><img src="../css/blueprint/plugins/buttons/icons/page_edit.png" alt=""/>编辑管理办法</button><button type="button" id="DELETE_BUTTON"><img src="../css/blueprint/plugins/buttons/icons/page_delete.png" alt=""/>删除管理办法</button></td>
        <td style="padding: 0px"><a href="DocPublish.html" class="button" target="_self"><img src="../css/blueprint/plugins/buttons/icons/page_add.png" alt=""/>发布管理办法</a></td>
    </tr>
</table>
<form id="DOC_FORM" action="" method="post">
<table id="DOC_TABLE" style="margin-top: 0px" width="98%" align="center" cellpadding="2" cellspacing="2">
    <thead>
        <tr>
            <th width="10%">选择</th>
            <th width="50%">标题</th>
            <th width="20%">创建时间</th>
            <th width="20%">更新时间</th>
        </tr>
    </thead>
    <tbody id="DOC_TBODY">
    </tbody>
    <tbody id="pageBar">
        <tr>
            <td colspan="7" nowrap="nowrap" width="100%">
                <table>
                    <tbody>
                        <tr>
                            <td height="25"><button type="button" class="first-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_first.png" alt=""/></button></td>
                            <td><button type="button" class="previous-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_previous.png" alt=""/></button></td>
                            <td width="20%"><span class="page-index-selector" style=""></span></td>
                            <td><button type="button" class="next-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_next.png" alt=""/></button></td>
                            <td><button type="button" class="last-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_last.png" alt=""/></button></td>
                            <td><select class="page-size-selector">
                                    <option value="10" selected="selected">10</option>
                                    <option value="20">20</option>
                                    <option value="30">30</option>
                                </select></td>
                            <td width="80%">&nbsp;</td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
</form>
</body>
</html>